package com.wyix.demo;

import com.wyix.entity.SmartPhone;
import com.wyix.util.PhoneFactory;

/**
 * @author wangdx
 * @since 2025/8/1
 */
public class TestPhoneProduction {
    public static void main(String[] args) {
        // 获取唯一工厂实例
        PhoneFactory factory = PhoneFactory.getInstance();

        // 生产入门款手机
        SmartPhone entryPhone = new SmartPhone("P001", "红米", "Note12");
        System.out.println("=== 入门款手机 ===");
        entryPhone.printInfo();

        // 生产旗舰款手机
        SmartPhone flagshipPhone = factory.producePhone(
                "P002", "小米", "14 Ultra", 5999.0
        );
        System.out.println("\n=== 旗舰款手机 ===");
        flagshipPhone.printInfo();
    }
}
